using System;
using System.Collections;
using System.Collections.Generic;

namespace Common.Core.Configuration
{
	public class DictionaryOfTExtension : CollectionOfTExtensionBase<IDictionary>
	{
		protected override Type GetCollectionType( Type typeArgument )
		{
			return typeof(Dictionary<,>).MakeGenericType( typeof(Object), typeArgument );
		}

		protected virtual void CopyItems( IDictionary oldItems )
		{
			var oldItemsAsDictionary = oldItems;
			var newItemsAsDictionary = Items;
			foreach ( DictionaryEntry entry in oldItemsAsDictionary )
			{
				newItemsAsDictionary[ entry.Key ] = oldItemsAsDictionary[ entry.Key ];
			}
		}
	}
}